package cn.edu.cqupt.cxcy.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.edu.cqupt.cxcy.dto.AdminImpl;
import cn.edu.cqupt.cxcy.util.Validate;


/**
 * 管理员后台主页
 * @author Dancer-mno
 * @date 2015年10月17日
 */
public class AdminUpdateCd extends HttpServlet {
	private static final long serialVersionUID = 1L;
	
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doPost(request, response);
	}
	
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		String temp_id  = request.getParameter("id");//场地id
		String temp_rs  = request.getParameter("rs");//审核情况
		String remarks  = request.getParameter("remarks");//审核情况
		boolean flag = false;
		if(Validate.stringIsNO(temp_id) && Validate.stringIsNO(temp_rs)) {
			int id = Integer.valueOf(temp_id);
			int rs = Integer.valueOf(temp_rs);
			if(id == 2 || id == 3) {
				new AdminImpl().updateCd(id, rs, remarks);
				flag = true;
			}
		}
		PrintWriter out = response.getWriter();
		out.println(flag);
		out.flush();
	}

}
